#include <string>
#include "WinRTSockChat.h"
//#include "tnet_transport.h"

using namespace WinRTSock_RuntimeComponents_Test;

//tnet_transport_t* server_transport;
//tnet_transport_t* client_transport;

WinRTSockChat::WinRTSockChat(void)
{
}


int WinRTSockChat::Start(Platform::String^ host, Platform::String^ port)
{
	int result = 0;
	
	///*server_transport = tnet_transport_create("localhost", 27015, tnet_socket_type_e(TNET_SOCKET_TYPE_TCP), "WinRTSock chat server");
	//if(server_transport) {
	//	result = tnet_transport_start(server_transport);
	//	if(result != 0)
	//		return -1;
	//}*/

	//client_transport = tnet_transport_create("localhost", 27015, tnet_socket_type_e(TNET_SOCKET_TYPE_UDP), "WinRTSock chat client");
	//if(client_transport) {
	//	result = tnet_transport_start(client_transport);
	//	if(result != 0)
	//		return -1;
	//}

	return 0;
}

void WinRTSockChat::Shutdown()
{
	//tnet_transport_shutdown(client_transport);
	////tnet_transport_shutdown(server_transport);
}

int WinRTSockChat::Send(Platform::String^ message, Platform::Boolean fromClient)
{
	//std::wstring wmsg(message->Begin(), message->End());
	//std::string msg(wmsg.begin(), wmsg.end());
	//int len = msg.length() + 1;
	//char* buffer = (char*)::malloc(len);
	//strcpy(buffer, msg.c_str());
	//tnet_transport_send(client_transport, client_transport->master->fd, buffer, msg.length());
	return 0;
}
